﻿using System.Linq;
using AspectsSample.Contracts;
using AspectsSample.DataModels;
using AspectsSample.Helpers;

namespace AspectsSample.Repositories
{
    internal class ChannelRepository : RepositoryBase, IChannelConfigRepository
    {
        public ChannelDataModel GetChannel(int id)
        {
            ReadXmlFile("ChannelConfig.xml");
            ChannelConfigDataModel configDataModel = null;
            SerialisationHelper.Deserialise(XmlDoc, ref configDataModel);
            return configDataModel.Channels.AsParallel().SingleOrDefault(c => c.Id == id);
        }

    }
}
